home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH10 / 10-1-5.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-18  |  2.0 KB  |  65 lines

  1. VERSION 5.00
  2. Begin VB.Form frm10_1_5 
  3.    Caption         =   "10-1-5"
  4.    ClientHeight    =   1815
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   2280
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   1815
  20.    ScaleWidth      =   2280
  21.    Begin VB.CommandButton cmdDraw 
  22.       Caption         =   "Draw"
  23.       Height          =   495
  24.       Left            =   480
  25.       TabIndex        =   1
  26.       Top             =   1200
  27.       Width           =   1335
  28.    End
  29.    Begin VB.PictureBox picOutput 
  30.       Height          =   975
  31.       Left            =   120
  32.       ScaleHeight     =   915
  33.       ScaleWidth      =   1995
  34.       TabIndex        =   0
  35.       Top             =   120
  36.       Width           =   2055
  37.    End
  38. Attribute VB_Name = "frm10_1_5"
  39. Attribute VB_GlobalNameSpace = False
  40. Attribute VB_Creatable = False
  41. Attribute VB_PredeclaredId = True
  42. Attribute VB_Exposed = False
  43. Private Sub cmdDraw_Click()
  44.   'Center and underline a phrase
  45.   Dim xCenter As Single, yCenter As Single, phrase As String
  46.   Dim w As Single, h As Single, leftEdge As Single, rightedge As Single
  47.   Dim ul1Pos As Single, ul2Pos As Single
  48.   picOutput.Scale (0, 4)-(6, 0)
  49.   picOutput.Cls
  50.   xCenter = 3
  51.   yCenter = 2
  52.   phrase = "Th-that's all Folks!"
  53.   w = picOutput.TextWidth(phrase)
  54.   h = picOutput.TextHeight(" ")
  55.   picOutput.CurrentX = xCenter - w / 2
  56.   picOutput.CurrentY = yCenter - h / 2
  57.   picOutput.Print phrase
  58.   leftEdge = xCenter - w / 2
  59.   rightedge = xCenter + w / 2
  60.   ul1Pos = yCenter + h / 2
  61.   ul2Pos = ul1Pos + h / 6
  62.   picOutput.Line (leftEdge, ul1Pos)-(rightedge, ul1Pos)
  63.   picOutput.Line (leftEdge, ul2Pos)-(rightedge, ul2Pos)
  64. End Sub
  65.